package com.lyp.crm.conrtoller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lyp.crm.entity.Fenye;
import com.lyp.crm.entity.Logj;
import com.lyp.crm.service.Logjdao;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Controller
@CrossOrigin(origins = "*")
public class LogjContrller {
	@Autowired
	private Logjdao logjdao;
	@Autowired
	private Fenye<Logj> fenye;
	/**
	 * 
	 * @param logj
	 * @param page
	 * @param rows
	 * @return
	 */
	@ApiOperation(value="多条件日志", notes="根据 url 的各种数据 来获取日志的详细信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "page", value = "分页参数", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "rows", value = "分页参数", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "ldate", value = "日志时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "lstid", value = "学生id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "lstname", value = "学生姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "lusid", value = "员工id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "lusname", value = "员工姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "loperate", value = "操作", required = true, dataType = "String", paramType = "path"), 
		
	})
	@ResponseBody
	@RequestMapping(value="/SelectLogj",method=RequestMethod.POST)
	public Fenye<Logj> SelectLogj(Logj logj,Integer page,Integer rows) {
		fenye.setPage((page-1)*rows);
		fenye.setPageSize(rows);
		fenye.setT(logj);
		fenye = logjdao.SelectLogj(fenye);
		System.out.println(fenye);
		return fenye;
	}
/**
 * 
 * @param logj
 * @return
 */
	@ApiOperation(value="增加日志", notes="根据 url 的数据 来增加一条日志的信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "ldate", value = "日志时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "lstid", value = "学生id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "lstname", value = "学生姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "lusid", value = "员工id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "lusname", value = "员工姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "loperate", value = "操作", required = true, dataType = "String", paramType = "path"), 
		
	})
	@ResponseBody
	@RequestMapping(value="/insertLogj",method=RequestMethod.POST)
	public Integer insertLogj(Logj logj) {
		// TODO Auto-generated method stub
		return logjdao.insertLogj(logj);
	}
}
